﻿using HY.Common;
using HY.Entity;
using HY.Service;
using HY.Web.Controllers;
using HY.Web.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace HY.Web.Areas.Resource.Controllers
{
    public class ResourceDictController : BaseController
    {
        BaseService service = new BaseService();
        // GET: Resource/ResourceDict
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 获取列表
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public JsonResult List()
        {
            ReturnModel returnModel = new ReturnModel();
            try
            {
                var code = Request.Form["Code"];
                var list = service.EFGetMany<ResourceDict>(s => s.IsDeleted == false);
                returnModel = base.GetReturnModel(list.Count, list);
            }
            catch (Exception ex)
            {
                returnModel = base.GetReturnModel(ex);
                LogHelper.Error(new LogInfo() { UserID = UserInfo.UserID, LogType = LogType.Select, LogMessage = "查询资源字典列表" }, ex);
            }
            return Json(returnModel);
        }
    }
}